<template>
  <div class="hot-articles-box">
    <div class="title">热门文章</div>
    <div class="acticles-list">
      <HotArticlesItem v-for="(item, index) of data" :key="index" :data="item" :index="index" />
      <div class="nodata" v-if="!data.length">暂无热门文章</div>
    </div>
  </div>
</template>

<script>
import HotArticlesItem from '@/views/home/components/HotArticlesItem';

export default {
  props: {
    data: {
      type: Array,
      default() {
        return []
      }
    }
  },
  components: {
    HotArticlesItem
  }
}
</script>

<style lang="scss" scoped>
.hot-articles-box {
  margin-bottom: 20px;
  .title {
    height: 32px;
    font-size: 24px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #272727;
    line-height: 32px;
    margin-bottom: 24px;
  }
  .acticles-list {
    width: 380px;
    background: #F9F9F9;
    border-radius: 4px;
    padding: 4px 20px 0;
    box-sizing: border-box;
    .nodata {
      width: 100%;
      height: 160px;
      line-height: 160px;
      text-align: center;
      margin-top: -4px;
      margin-left: -20px;
      color: #C0C4CC;
    }
  }
}
</style>